package com.ghsc.ghxc.jsb.ui.live.adapter

import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cn.appcore.ext.getCompatColor
import com.cn.appcore.utils.GlideUtil
import com.flyco.roundview.RoundTextView
import com.ghsc.ghxc.jsb.R
import com.ghsc.ghxc.jsb.ui.message.bean.ChatDataResultBean

/**
 * 项目：GuoHuaMall
 * 包名：com.ghsc.ghxc.ui.message.adapter
 * 类名：FriendsListAdapter
 * 创建时间：2023/7/11 19:07
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class FriendsListAdapter   : BaseQuickAdapter<ChatDataResultBean, BaseViewHolder>(
    R.layout.friends_item) {

    override fun convert(helper: BaseViewHolder, item: ChatDataResultBean) {
        GlideUtil.ImageHeadLoad(this.context, item.headimg, helper.getView(R.id.userImgUrl))
        helper.setText(R.id.tvName, item.nickname)
        var textStatus = helper.getView<RoundTextView>(R.id.tvBtnNext)
        //1 双方都通过   -1显示等待通过状态 -2 显示通过 按钮
        if (item.status == 1)
            textStatus.visibility = View.GONE
        else if (item.status == -1) {
            textStatus.visibility = View.VISIBLE
            textStatus.text = "等待通过"
            textStatus.delegate.backgroundColor = this.context.getCompatColor( R.color.btn_lvse)
        } else if (item.status == -2) {
            textStatus.visibility = View.VISIBLE
            textStatus.text = "通过"
            textStatus.delegate.backgroundColor =
                this.context.getCompatColor( R.color.btn_default_color)
        } else textStatus.visibility = View.GONE
        helper.setGone(R.id.imgCheck, true)

    }
}



